/**
 * Do checks to ensure plug-in/browser/platform support
 */
var check = {
	
	browser : null,
	version : null,
	
	embedCheck : function(e) {
		if (e.success === false) {
			flash.fatal('Flash Player not present', 'Please install/upgrade your Adobe Flash player to view this website. <a href=\'http://get.adobe.com/flashplayer/\'>Read how</a>.');
		}
	},
	
	systemCheck : function() {
		this.browserInit();
		if (this.browser == 'msie' && this.version < 8) {
			flash.warning('Internet Explorer', 'You are using an old version of Internet Explorer browser, some functions of this website may not behave as expected. Please upgrade your browser. <a href=\'http://www.microsoft.com/windows/internet-explorer/default.aspx\'>Read how</a>');
		} else if (this.browser == 'msie' && this.version == 8) {
			//flash.warning('Internet Explorer', 'Preferrably, visit vdjo.com in another browser. <a href="/page/faq#browsers">Read more</a>.');
		} else if (this.browser == 'opera') {
			flash.warning('Opera Browser', 'Preferrably, visit vdjo.com in another browser. <a href="/page/faq#browsers">Read more</a>.');
		}
		// beta version
		// flash.notice('Alpha version', 'The vdjo.com baby is growing! <a href=\'/testpanel\'>We\'re open to any suggestion for improvement or comments!</a>.', 'fixed');
	},
	
	browserInit : function() {
		// script from: http://www.tvidesign.co.uk/blog/CSS-Browser-detection-using-jQuery-instead-of-hacks.aspx
		
		var userAgent = navigator.userAgent.toLowerCase();
	    $.browser.chrome = /chrome/.test(navigator.userAgent.toLowerCase()); 
	    
	    // Is this a version of IE?
	    if($.browser.msie){
	       this.browser = 'msie';
	       this.version = $.browser.version.substring(0,1);
	    }	    
	    
	    // Is this a version of Chrome?
	    if($.browser.chrome){
	    	this.browser = 'chrome';	        
	        this.version = userAgent.substring(userAgent.indexOf('chrome/') +7);
	        this.version = this.version.substring(0,1);        
	        // If it is chrome then jQuery thinks it's safari so we have to tell it it isn't
	        $.browser.safari = false;
	    }
	    
	    // Is this a version of Safari?
	    if($.browser.safari){
	        this.browser = 'safari';
	        this.version = userAgent.substring(userAgent.indexOf('version/') +8);
	        this.version = this.version.substring(0,1);
	    }
	    
	    // Is this a version of Mozilla?
	    if($.browser.mozilla){
	        //Is it Firefox?
	        if(navigator.userAgent.toLowerCase().indexOf('firefox') != -1){
	            this.browser = 'firefox';
	            this.version = userAgent.substring(userAgent.indexOf('firefox/') +8);
	            this.version = this.version.substring(0,1);
	        }
	        // If not then it must be another Mozilla
	        else{
	            this.browser = 'mozilla';
	        }
	    }
	    
	    // Is this a version of Opera?
	    if($.browser.opera){
			this.browser = 'opera'
	    }
	}
		
}